From 0a7651bcce1fb59a15d3e7195fb58b10f42f4786 Mon Sep 17 00:00:00 2001 From: Jimi Xenidis Date: Sun, 17 Dec 2006 12:40:10 -0500 Subject: [PATCH] [XEN][POWERPC] get cpu_*_maps correct so physinfo and affinity is accurate Signed-off-by: Jimi Xenidis Signed-off-by: Hollis Blanchard --HG-- extra : transplant_source : %B0N%24%DB0%8F%22%15%C6%BA%FA%F3X%D1%C1%0D%A7%9F%24O --- xen/arch/powerpc/powerpc64/ppc970.c | 7 ++++++- xen/arch/powerpc/setup.c | 19 +++++++++++++------ xen/arch/powerpc/sysctl.c | 10 +++++++--- xen/include/asm-powerpc/processor.h | 1 + 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/xen/arch/powerpc/powerpc64/ppc970.c b/xen/arch/powerpc/powerpc64/ppc970.c index 9b8ad111ba..64a05571f6 100644 --- a/xen/arch/powerpc/powerpc64/ppc970.c +++ b/xen/arch/powerpc/powerpc64/ppc970.c @@ -129,7 +129,6 @@ unsigned int cpu_extent_order(void) return log_large_page_sizes[0] - PAGE_SHIFT; } - /* This is more a platform thing than a CPU thing, but we only have * one platform now */ int cpu_io_mfn(ulong mfn) @@ -142,6 +141,12 @@ int cpu_io_mfn(ulong mfn) return 0; } +int cpu_threads(int cpuid) +{ + return 1; +} + + static u64 cpu0_hids[6]; static u64 cpu0_hior; diff --git a/xen/arch/powerpc/setup.c b/xen/arch/powerpc/setup.c index c22e6712bb..2392cd9650 100644 --- a/xen/arch/powerpc/setup.c +++ b/xen/arch/powerpc/setup.c @@ -179,9 +179,6 @@ static void __init start_of_day(void) set_current(idle_domain->vcpu[0]); idle_vcpu[0] = current; - /* for some reason we need to set our own bit in the thread map */ - cpu_set(0, cpu_sibling_map[0]); - initialize_keytable(); /* Register another key that will allow for the the Harware Probe * to be contacted, this works with RiscWatch probes and should @@ -247,6 +244,19 @@ static int kick_secondary_cpus(int maxcpus) int cpuid; for_each_present_cpu(cpuid) { + int threads; + int i; + + threads = cpu_threads(cpuid); + for (i = 0; i < threads; i++) + cpu_set(i, cpu_sibling_map[cpuid]); + + /* For now everything is single core */ + cpu_set(0, cpu_core_map[cpuid]); + + numa_set_node(cpuid, 0); + numa_add_cpu(cpuid); + if (cpuid == 0) continue; if (cpuid >= maxcpus) @@ -257,9 +267,6 @@ static int kick_secondary_cpus(int maxcpus) /* wait for it */ while (!cpu_online(cpuid)) cpu_relax(); - - numa_set_node(cpuid, 0); - numa_add_cpu(cpuid); } return 0; diff --git a/xen/arch/powerpc/sysctl.c b/xen/arch/powerpc/sysctl.c index 5d25d696fd..3b25b5f89b 100644 --- a/xen/arch/powerpc/sysctl.c +++ b/xen/arch/powerpc/sysctl.c @@ -41,9 +41,13 @@ long arch_do_sysctl(struct xen_sysctl *sysctl, { xen_sysctl_physinfo_t *pi = &sysctl->u.physinfo; - pi->threads_per_core = 1; - pi->cores_per_socket = 1; - pi->sockets_per_node = 1; + pi->threads_per_core = + cpus_weight(cpu_sibling_map[0]); + pi->cores_per_socket = + cpus_weight(cpu_core_map[0]) / pi->threads_per_core; + pi->sockets_per_node = + num_online_cpus() / cpus_weight(cpu_core_map[0]); + pi->nr_nodes = 1; pi->total_pages = total_pages; pi->free_pages = avail_domheap_pages(); diff --git a/xen/include/asm-powerpc/processor.h b/xen/include/asm-powerpc/processor.h index 50d544b9ea..3a4ad04260 100644 --- a/xen/include/asm-powerpc/processor.h +++ b/xen/include/asm-powerpc/processor.h @@ -125,6 +125,7 @@ extern uint cpu_large_page_orders(uint *sizes, uint max); extern void cpu_initialize(int cpuid); extern void cpu_init_vcpu(struct vcpu *); extern int cpu_io_mfn(ulong mfn); +extern int cpu_threads(int cpuid); extern void save_cpu_sprs(struct vcpu *); extern void load_cpu_sprs(struct vcpu *); extern void flush_segments(void); -- 2.30.2